#include "Lexer.h"
#include "Parser.h"
#include <iostream>

int main()
{
    std::string sql = R"(
CREATE TABLE users (
    id INT PRIMARY KEY,
    name VARCHAR(50) NOT NULL,
    age INT,
    email VARCHAR(100)
);

INSERT INTO users VALUES (1, 'Alice', 25, 'alice@example.com');
SELECT * FROM users WHERE age > 20;
)";

    MiniDB::Lexer lexer(sql);
    auto tokens = lexer.tokenize();

    MiniDB::Parser parser(tokens);
    auto statements = parser.parse();

    std::cout << "语法分析结果 (AST):" << std::endl;
    for (size_t i = 0; i < statements.size(); ++i)
    {
        std::cout << "\n语句 " << (i + 1) << ":" << std::endl;
        std::cout << statements[i]->toString();
    }

    return 0;
}
